#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull a, b, n;
ull qexp(int i, int x) {
  if (x == 0) return 1;
  ull half = qexp(i, x / 2);
  ull res = half * half;
  if (x & 1) res *= i;
  return res;
}
ull get(int n, int x) {
  switch (x) {
    case 0:
      return n;
    case 1:
      return n * (n + 1) / 2;
    case 2:
      return n * (n + 1) * (2 * n + 1) / 6;
    case 3:
      return (n * (n + 1) / 2) * (n * (n + 1) / 2);
    case 4:
      return n * (n + 1) * (2 * n + 1) * (3 * n * n + 3 * n - 1) / 30;
  }
  return x;
}
ull calc(int x) {
  ull ans2 = 0;
  ull ans = 0;
  for (ull l = 1, r = 0; l <= n; l = r + 1) {
    r = n / (n / l);
    ans += n / l * get(l, x);
  }
  return ans;
}
int main() {
  cin >> a >> b >> n;
  cout << (calc(a) ^ calc(b)) << endl;
}
